package main

func main() {

}

type ListNode struct {
	Val  int
	Next *ListNode
}

/**
 * @Description: 采用快慢指针实现，快的每次走两步，慢的每次走一步
 */
func hasCycle(head *ListNode) bool {
	fast, low := head, head
	for fast != nil && fast.Next != nil {
		fast = fast.Next.Next
		low = low.Next
		if fast == low {
			return true
		}
	}
	return false
}
